package com.bootdo.front.controller;

import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.bootdo.front.domain.ProjectExperienceDO;
import com.bootdo.front.service.ProjectExperienceService;
import com.bootdo.common.utils.PageUtils;
import com.bootdo.common.utils.Query;
import com.bootdo.common.utils.R;

/**
 * 项目经验表
 * 
 * @author wjs
 * @email 1992lcg@163.com
 * @date 2020-02-17 21:16:46
 */
 
@Controller
@RequestMapping("/front/projectExperience")
public class ProjectExperienceController {
	@Autowired
	private ProjectExperienceService projectExperienceService;

	
	@GetMapping("/add")
	@RequiresPermissions("front:projectExperience:add")
	String add(){
	    return "front/projectExperience/add";
	}

	/**
	 * 保存
	 */
	@ResponseBody
	@PostMapping("/save")
	@RequiresPermissions("front:projectExperience:add")
	public R save( ProjectExperienceDO projectExperience){
		if(projectExperienceService.save(projectExperience)>0){
			return R.ok();
		}
		return R.error();
	}

	/**
	 * 修改
	 */
	@ResponseBody
	@RequestMapping("/update")
	@RequiresPermissions("front:projectExperience:edit")
	public R update( ProjectExperienceDO projectExperience){
		projectExperienceService.update(projectExperience);
		return R.ok();
	}
	
	/**
	 * 删除
	 */
	@PostMapping( "/remove")
	@ResponseBody
	@RequiresPermissions("front:projectExperience:remove")
	public R remove( Long id){
		if(projectExperienceService.remove(id)>0){
		return R.ok();
		}
		return R.error();
	}
	
	/**
	 * 删除
	 */
	@PostMapping( "/batchRemove")
	@ResponseBody
	@RequiresPermissions("front:projectExperience:batchRemove")
	public R remove(@RequestParam("ids[]") Long[] ids){
		projectExperienceService.batchRemove(ids);
		return R.ok();
	}
	
}
